import { addAccount, delAccount, searchAccount } from '@/api/account'
const account = {
  state: {},

  mutations: {},

  actions: {
    // 新增
    AddAccount ({ commit }, accountInfo) {
      return new Promise((resolve, reject) => {
        addAccount(accountInfo)
          .then(response => {
            resolve(response)
          })
          .catch(error => {
            reject(error)
          })
      })
    },
    // 删除
    DelAccount ({ commit }, id) {
      console.log(id)
      return new Promise((resolve, reject) => {
        delAccount(id)
          .then(response => {
            resolve(response)
          })
          .catch(error => {
            reject(error)
          })
      })
    },
    // 搜索
    SearchAccount ({ commit }, id) {
      return new Promise((resolve, reject) => {
        searchAccount(id)
          .then(response => {
            resolve(response)
          })
          .catch(error => {
            reject(error)
          })
      })
    }
  }
}

export default account
